]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Bail early from check over all permutations
authorAlexander Larsson <alexl@redhat.com>
Thu, 3 Mar 2011 15:29:05 +0000 (16:29 +0100)
committerAlexander Larsson <alexl@redhat.com>
Wed, 9 Mar 2011 09:45:21 +0000 (10:45 +0100)
If we're already doing worse than the best so far there is
no need to continue checking this particular permutation.

https://bugzilla.gnome.org/show_bug.cgi?id=609258

js/ui/workspace.js

index a2c7172a458de6c2f9b14bf19b889368839e45ff..9a80f8c8e18402e217ee4e6ad99fae025ec6fa32 100644 (file)
@@ -735,6 +735,12 @@ Workspace.prototype = {
                 let delta = this._computeWindowMotion(cloneActor, slot);
 
                 motion += delta;
+
+                // Bail out early if we're already larger than the
+                // previous best
+                if (minimumMotionPermutation != null &&
+                    motion > minimumMotion)
+                    continue;
             }
 
             if (minimumMotionPermutation == null || motion < minimumMotion) {